import Vue from 'vue'
import App from './App.vue'
import iView from 'iview';
import 'iview/dist/styles/iview.css';
import {routes} from './routes';
import VueRouter from 'vue-router';
import axios from 'axios'
import VueAxios from 'vue-axios'
import {store} from './store'
Vue.use(VueAxios, axios)
Vue.use(iView);
Vue.use(VueRouter);

axios.interceptors.request.use(function (config) {
  // Do something before request is sent
  config.headers.authorization='Bearer '+store.getters.token;
  return config;
}, function (error) {
  // Do something with request error
  return Promise.reject(error);
});
export const eventBus = new Vue();
const router = new VueRouter({
	routes:routes, 
	mode:'history' 
});

new Vue({
  el: '#app',
  router, // router:router 
  store,
  render: h => h(App)
})